﻿using DXApplicationTangche.UC.有赞.Service;
using DXApplicationTangche.UC.订单一览新.订单预览新.service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.有赞.有赞商品
{
    public partial class Form更新有赞SKU : DevExpress.XtraEditors.XtraForm
    {
        private int itemId { get; set; }
        public Form更新有赞SKU()
        {
            InitializeComponent();
        }
        public Form更新有赞SKU(String itemId, String title, String detailUrl)
        {
            InitializeComponent();
            this.itemId = Convert.ToInt32(itemId);
            this.textBox商品Id.Text = this.itemId.ToString();
            this.textBox款式名称.Text = title;
            this.hyperLinkEdit商品链接.Text = detailUrl;
        }

        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.textBox参考成衣码.Text.Trim()))
            {
                MessageBox.Show("成衣码不能为空");
                return;
            }
            OrderCommitDTO返回 orderCommitDTO =
                                订单预览新Service.getOrderCommitDTOByBarcode(this.textBox参考成衣码.Text.Trim());
            if (String.IsNullOrEmpty(orderCommitDTO.styleNameCn))
            {
                MessageBox.Show("成衣码错误");
                return;
            }
            有赞商品Service
                .saveSpuCost(
                this.itemId,
                orderCommitDTO.styleNameCn,
                orderCommitDTO.materialCode,
                orderCommitDTO.materialNameCn,
                orderCommitDTO.composition,
                this.textBox参考成衣码.Text.Trim(),
                orderCommitDTO.price,
                Convert.ToDouble(this.textBox有赞售价.Text.Trim())
                );
            this.Close();
        }
    }
}
